const router = require('koa-router')()
const user = require('./users');
const article=require("./article")
const tag=require('./tag')
const project=require('./project')
const comment=require('./comment')
router.get('/', async (ctx, next) => {
  // console.log(user.register)
  await ctx.render('index', {
    title: 'Hello Koa 2!'
  })
})
//登录注册
router.post('/register', user.register)
router.post('/login',user.login)
//文章
router.get('/getArticleList',article.getArticleList)
router.post('/getArtiDetail',article.getArtiDetail)
router.post('/addArticle', article.addArticle)
router.post('/likeArticle',article.likeArticle)
router.post('/updateArticle',article.updateArticle)
//标签
router.get('/getTagList',tag.getTagList)
//项目
router.get('/getProjectList',project.getProjectList)
//评论
router.post('/addComment',comment.addComment)
router.post('/addThirdCom',comment.addThirdCom)
router.get('/getOtherCom',comment.getOtherCom)
// router.get('/string', async (ctx, next) => {
//   ctx.body = 'koa2 string'
// })

// router.get('/json', async (ctx, next) => {
//   ctx.body = {
//     title: 'koa2 json'
//   }
// })

module.exports = router
